package info.zhoutian.blog.service;

import info.zhoutian.blog.domain.Girl;
import info.zhoutian.blog.enums.ResultEnums;
import info.zhoutian.blog.exception.GirlException;
import info.zhoutian.blog.repository.GirlRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Administrator on 2018/8/24.
 */
@Service
public class GirlService {

    @Autowired
    private GirlRepository girlRepository;



    public Girl addGirl(Girl girl){

        if(girl.getAge() >100){

            throw new GirlException(ResultEnums.PRIMARY_SHOOOL);
        }

        return girlRepository.save(girl);
    }
}
